package com.yeban.javase.review.previevew;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/27
 */
public class SerializableDemo2 {

    public static void main(String[] args) {
        try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream("src/com/yeban/javase/review/text/user.txt"));) {
            User u = (User)ois.readObject();
            System.out.println("user = " + u);
            System.out.println("反序列化完毕~");
        } catch (IOException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
